<template>
<div>
  <!-- 侧边栏 -->
  <el-menu
    class="el-menu-boss-demo"
    background-color="#333744"
    text-color="#fff"
    active-text-color="#409eff"
    :router="true"
    :default-active="activePath"
  >
    <h3 style="color:#fff">&nbsp;&nbsp;Easy-Shop</h3>
    <!-- 一级菜单 -->
    <el-menu-item index="/cash0" @click="saveNavState('/cash0')">
      <i class="el-icon-shopping-cart-1"></i>
      <span slot="title">收银</span>
    </el-menu-item>
    <el-menu-item index="/refundcash0" @click="saveNavState('/refundcash0')">
      <i class="el-icon-s-release"></i>
      <span slot="title">退货</span>
    </el-menu-item>
    <el-menu-item index="/stock0" @click="saveNavState('/stock0')">
      <i class="el-icon-s-shop"></i>
      <span slot="title">库存</span>
    </el-menu-item>
    <el-menu-item index="/sales0" @click="saveNavState('/sales0')">
      <i class="el-icon-s-order"></i>
      <span slot="title">生意</span>
    </el-menu-item>


    <el-submenu index="users">
      <template slot="title">
        <i class="el-icon-s-management"></i>
        <span>人员管理</span>
      </template>
      <el-menu-item index="/staffitem0" @click="saveNavState('/staffitem0')">
        <i class="el-icon-user"></i>
        <span slot="title">用户管理</span>
      </el-menu-item>
      <el-menu-item index="/supplieritem0" @click="saveNavState('/supplieritem0')">
        <i class="el-icon-s-custom"></i>
        <span slot="title">供应商管理</span>
      </el-menu-item>
    </el-submenu>
    <el-menu-item index="/personalmgt0" @click="saveNavState('/personalmgt0')">
      <i class="el-icon-setting"></i>
      <span slot="title">个人中心</span>
    </el-menu-item>
  </el-menu>
</div>
</template>

<script>
export default {
  name: 'BossAside',
  data(){
    return{
      //被激活的链接地址
      activePath:'/'
    }
  },
  methods:{
  //保存链接的激活
    saveNavState(activePath){
      window.sessionStorage.setItem('activePath',activePath)
      this.activePath=window.sessionStorage.getItem('activePath')
    }
  },
}
</script>

<style scoped>
.el-menu-boss-demo:not(.el-menu--collapse) {
  width: 230px;
  height: 730px;
}
h3 {
  color: #ffffff;
  text-align: center;
  line-height: 48px;
}

</style>
